import React, { Component } from "react";
import {View,StyleSheet} from 'react-native'
import {WebView} from 'react-native-webview'
import {width} from "../../util/apdater_util";
import ProgressBar from "../../widget/ProgressBar";

export default class WebViewVC extends Component{
  constructor(props) {
    super(props);
    this.state={
      url:'',
      progress:0
    }
  }
  componentDidMount() {

    let url=this.props.route.params.url
    console.log(url)
    this.setState({url:'https://www.baidu.com'})
  }

  render() {
    return (
      <View style={{flex:1}}>
        {this.state.progress !== 1 && <ProgressBar
          fillStyle={{}}
          backgroundStyle={{backgroundColor: '#cccccc', borderRadius: 2}}
          style={{marginTop:0}}
          progress={this.state.progress}
        />}
        <WebView source={{uri:this.state.url}} onLoadProgress={({nativeEvent}) => this.setState(
          {progress: nativeEvent.progress}
        )}></WebView>
      </View>
    )
  }
}

const styles=StyleSheet.create({

})


